package com.sky.controller.user;

import com.sky.pojo.Category;
import com.sky.result.Result;

import com.sky.service.admin.CategoryService;
import com.sky.service.admin.impl.CategoryServiceImpl;
import com.sky.service.user.UserCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@Api(tags = "用户端分类相关接口")
@RequiredArgsConstructor
public class UserCategoryController {
    private final UserCategoryService userCategoryService;
    private final CategoryService categoryService;

    @GetMapping("/user/category/list")
    @ApiOperation("获取分类列表")
    public Result<List<Category>> listFromCache(Integer type){
        log.info("获取分类列表");
        List<Category> list=categoryService.listFromCache( type);
        return Result.success(list);
    }
    /*@GetMapping("/user/category/list")
    @ApiOperation("根据类型查询分类")
    public Result<List<Category>> listFromCache(Integer type) {
        List<Category> list = userCategoryService.listFromCache1(type);
        return Result.success(list);
    }*/
}
